<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Chapter&#160;11.&#160;Boost.Functional/Hash</title>
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="libraries.html" title="Part&#160;I.&#160;The Boost C++ Libraries (BoostBook Subset)">
<link rel="prev" href="function/testsuite.html" title="Testsuite">
<link rel="next" href="hash/tutorial.html" title="Tutorial">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
<td align="center"><a href="../../index.html">Home</a></td>
<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="function/testsuite.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hash/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
<a name="hash"></a>Chapter&#160;11.&#160;Boost.Functional/Hash</h2></div>
<div><div class="author"><h3 class="author">
<span class="firstname">Daniel</span> <span class="surname">James</span>
</h3></div></div>
<div><p class="copyright">Copyright &#169; 2005-2008 Daniel
      James</p></div>
<div><div class="legalnotice">
<a name="hash.legal"></a><p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></div>
</div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="section"><a href="hash.html#hash.intro">Introduction</a></span></dt>
<dt><span class="section"><a href="hash/tutorial.html">Tutorial</a></span></dt>
<dt><span class="section"><a href="hash/custom.html">Extending boost::hash for a custom data type</a></span></dt>
<dt><span class="section"><a href="hash/combine.html">Combining hash values</a></span></dt>
<dt><span class="section"><a href="hash/portability.html">Portability</a></span></dt>
<dt><span class="section"><a href="hash/disable.html">Disabling The Extensions</a></span></dt>
<dt><span class="section"><a href="hash/changes.html">Change Log</a></span></dt>
<dt><span class="section"><a href="hash/rationale.html">Rationale</a></span></dt>
<dt><span class="section"><a href="hash/reference.html">Reference</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="hash/reference.html#hash.reference.specification"></a></span></dt>
<dt><span class="section"><a href="hash/reference.html#header.boost.functional.hash_hpp">Header &lt;boost/functional/hash.hpp&gt;</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="hash/links.html">Links</a></span></dt>
<dt><span class="section"><a href="hash/acknowledgements.html">Acknowledgements</a></span></dt>
</dl>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="hash.intro"></a><a class="link" href="hash.html#hash.intro" title="Introduction">Introduction</a>
</h2></div></div></div>
<p>
      <code class="computeroutput"><a class="link" href="boost/hash.html" title="Struct template hash">boost::hash</a></code> is an implementation of
      the <a href="http://en.wikipedia.org/wiki/Hash_function" target="_top">hash function</a>
      object specified by the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Draft
      Technical Report on C++ Library Extensions</a> (TR1). It is the default
      hash function for <a class="link" href="unordered.html" title="Chapter&#160;35.&#160;Boost.Unordered">Boost.Unordered</a>, <a class="link" href="intrusive/unordered_set_unordered_multiset.html" title="Semi-Intrusive unordered associative containers: unordered_set, unordered_multiset">Boost.Intrusive</a>'s
      unordered associative containers, and <a href="../../libs/multi_index/doc/index.html" target="_top">Boost.MultiIndex</a>'s
      hash indicies and <a href="../../libs/bimap/index.html" target="_top">Boost.Bimap</a>'s
      <code class="computeroutput"><span class="identifier">unordered_set_of</span></code>.
    </p>
<p>
      As it is compliant with <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">TR1</a>,
      it will work with:
    </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
          integers
        </li>
<li class="listitem">
          floats
        </li>
<li class="listitem">
          pointers
        </li>
<li class="listitem">
          strings
        </li>
</ul></div>
<p>
      It also implements the extension proposed by Peter Dimov in issue 6.18 of the
      <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf" target="_top">Library
      Extension Technical Report Issues List</a> (page 63), this adds support
      for:
    </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
          arrays
        </li>
<li class="listitem">
          <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></code>
        </li>
<li class="listitem">
          the standard containers.
        </li>
<li class="listitem">
          extending <code class="computeroutput"><a class="link" href="boost/hash.html" title="Struct template hash">boost::hash</a></code> for custom
          types.
        </li>
</ul></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
        This hash function is designed to be used in containers based on the STL
        and is not suitable as a general purpose hash function. For more details
        see the <a class="link" href="hash/rationale.html" title="Rationale">rationale</a>.
      </p></td></tr>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: January 31, 2013 at 01:30:18 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="function/testsuite.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hash/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
